package com.mayikt.days06;

/**
 * @ClassName Test002
 * @Author 蚂蚁课堂余胜军 QQ644064779 www.mayikt.com
 * @Version V1.0
 **/
public class Test002 implements MayiktMTCallable<String> {
    @Override
    public String call() throws Exception {
        try {
            Thread.sleep(3000);
            System.out.println(Thread.currentThread().getName() + ",发送短信完成..");
            return null;
        } catch (Exception e) {
            return "发送短信失败.";
        }
    }

    public static void main(String[] args) {
        MayiktFutureTask<String> mayiktFutureTask = new MayiktFutureTask<>(new Test002());
        new Thread(mayiktFutureTask).start();
        String s = mayiktFutureTask.get();
        System.out.println("手写future 模式 获取结果" + s);
    }
}
